#include "myprogressdialog.h"
#include "ui_myprogressdialog.h"

myProgressDialog::myProgressDialog(QWidget *parent, Qt::WindowFlags f) :
    QDialog(parent, f),
    m_ui(new Ui::myProgressDialog)
{
    m_ui->setupUi(this);
    setWindowModality( Qt::NonModal );
}

myProgressDialog::~myProgressDialog()
{
    delete m_ui;
}

void myProgressDialog::reset()
{
    m_ui->progressBar->setValue( m_ui->progressBar->minimum() );
}

void myProgressDialog::setValue( int value )
{
    m_ui->progressBar->setValue( value );
    if ( value == m_ui->progressBar->maximum() )
        accept();
}

int myProgressDialog::maximum()
{
    return m_ui->progressBar->maximum();
}

void myProgressDialog::on_cancelButton_clicked()
{
    cancelCalled();
    reject();
}
